import { Module } from '@nestjs/common'
import { WxUserService } from './wx-user.service'
import { WxUserController } from './wx-user.controller'
import { JwtModule } from '@nestjs/jwt'
import { ConfigModule, ConfigService } from '@nestjs/config'

@Module({
  imports: [
    JwtModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => {
        return {
          secret: config.get('TOKEN_SECRET'),
          signOptions: {
            expiresIn: '10h',
          },
        }
      },
    }),
  ],
  controllers: [WxUserController],
  providers: [WxUserService],
})
export class WxUserModule {}
